package com.ss.android.article.base.feature.app.browser;

import android.os.Message;

import com.bytedance.common.utility.collection.WeakHandler;
import com.ss.android.article.base.app.BizApplication;
import com.ss.android.article.base.feature.app.b.DBHelper;
import com.ss.android.article.base.feature.detail.model.ArticleDetail;
import com.ss.android.article.base.feature.feed.presenter.ArticleQueryThread;
import com.ss.android.article.base.feature.model.Article;
import com.ss.android.common.AbsApiThread;

public final class g extends AbsApiThread {
    private Article a;
    private WeakHandler b;

    public g(WeakHandler arg1, Article arg2) {

        this.b = arg1;
        this.a = arg2;
    }

    public final void run() {
        ArticleDetail v0_1;
        int v1_3 = 11;
        ArticleDetail v6_1;
        Throwable v2_1;
        ArticleDetail v1_2;
        Throwable v6;
        ArticleDetail v2 = null;
        DBHelper v1_1;
        int v0 = 11;
        super.run();
        try {
            v1_1 = DBHelper.getInstance(BizApplication.getApplication());
            v2 = v1_1.queryArticleDetail(this.a, true);
            if (v2 == null) {
                v1_2 = ArticleQueryThread.getArticleDetail(v1_1, this.a, true, null);
            } else if (v2.article != null) {
                v1_2 = v2;
            } else {
                v1_2 = ArticleQueryThread.getArticleDetail(v1_1, this.a, true, null);
            }


            label_15:
            if (v1_2 != null) {
                if (v1_2.article == null) {
//                    goto label_19;
                } else {
                    v0 = 10;
                }
            }

            label_19:
            v6_1 = v1_2;
            v1_3 = v0;
            v0_1 = v6_1;
        }catch (Throwable e){
            v0_1 = v2;

        }
//        label_22:
        Message v1_4 = this.b.obtainMessage(v1_3);
        if (v0_1 != null) {
            v1_4.obj = v0_1.article;
        }

        this.b.sendMessage(v1_4);
    }
}

